<f:subview
  xmlns:c="http://java.sun.com/jstl/core"
  xmlns:f="http://java.sun.com/jsf/core"
  xmlns:h="http://java.sun.com/jsf/html"
  xmlns:nxl="http://nuxeo.org/nxforms/layout"
  xmlns:nxu="http://nuxeo.org/nxweb/util"
  xmlns:nxd="http://nuxeo.org/nxweb/document"
  id="#{layout.id}">
<c:if test="#{layout.mode == 'view_list_and_header'}">

  <thead>
    <tr>
      <nxl:layoutRow>
        <nxl:layoutRowWidget>
          <th>
            <h:outputText value="#{widget.label}" rendered="#{!widget.translated}" />
            <h:outputText value="#{messages[widget.label]}" rendered="#{widget.translated}" />
          </th>
        </nxl:layoutRowWidget>
      </nxl:layoutRow>

      <c:if test="#{!isReadOnly}">
        <th>
        </th>
      </c:if>

    </tr>
  </thead>
  <tr class="#{directoryEntryClass}">
    <nxl:layoutRow>
      <nxl:layoutRowWidget>
        <td class="fieldColumn">
          <nxl:widget widget="#{widget}" value="#{value}" />
        </td>
      </nxl:layoutRowWidget>
    </nxl:layoutRow>

    <c:if test="#{!isReadOnly}">
      <td class="fieldColumn">
        <h:commandButton value="#{messages['command.edit']}"
          id="#{layout.id}_editButton"
          styleClass="button"
          action="#{bean.editEntry(value.id)}"
          immediate="true"/>

        <h:commandButton value="#{messages['command.delete']}"
          id="#{layout.id}_deleteButton"
          styleClass="button"
          action="#{bean.deleteEntry(value.id)}"
          onclick="return confirmDeleteDirectoryEntry()"
          immediate="true" />
      </td>
    </c:if>

  </tr>

</c:if>

<c:if test="#{layout.mode == 'view_list'}">

  <tr class="#{directoryEntryClass}">
    <nxl:layoutRow>
      <nxl:layoutRowWidget>
        <td class="fieldColumn">
          <nxl:widget widget="#{widget}" value="#{value}" />
        </td>
      </nxl:layoutRowWidget>
    </nxl:layoutRow>
      <c:if test="#{!isReadOnly}">
        <td class="fieldColumn">
          <h:commandButton value="#{messages['command.edit']}"
            id="#{layout.id}_editButton"
            styleClass="button"
            action="#{bean.editEntry(value.id)}"
            immediate="true" />

          <h:commandButton value="#{messages['command.delete']}"
            id="#{layout.id}_deleteButton"
            styleClass="button"
            action="#{bean.deleteEntry(value.id)}"
            onclick="return confirmDeleteDirectoryEntry()"
            immediate="true" />
        </td>
      </c:if>
  </tr>

</c:if>


<c:if test="#{layout.mode == 'view'}">

  <table class="dataInput">
    <tbody>

      <nxl:layoutRow>
        <tr>
          <nxl:layoutRowWidget>
            <td class="labelColumn">
              <h:outputText value="#{widget.label}" rendered="#{!widget.translated}" />
              <h:outputText value="#{messages[widget.label]}" rendered="#{widget.translated}" />
            </td>
            <td class="fieldColumn">
              <nxl:widget widget="#{widget}" value="#{value}" />
            </td>
          </nxl:layoutRowWidget>
        </tr>
      </nxl:layoutRow>

    </tbody>
  </table>

</c:if>

<c:if test="#{layout.mode == 'edit' or layout.mode == 'create'}">

  <table class="dataInput currentDocumentInformation">
    <tbody>

      <nxl:layoutRow>
        <tr>
          <nxl:layoutRowWidget>
            <td class="relationCreateLabelColumn">
              <h:outputText value="#{widget.label}" rendered="#{!widget.translated}"
                styleClass="#{nxu:test(widget.required, 'required', '')}" />
              <h:outputText value="#{messages[widget.label]}" rendered="#{widget.translated}"
                styleClass="#{nxu:test(widget.required, 'required', '')}" />
            </td>
            <td class="relationCreateFieldColumn">
              <nxl:widget widget="#{widget}" value="#{value}" />
            </td>
            <td><span class="help">
                 <h:outputText value="#{messages[widget.properties.help]}" />
               </span>
            </td>
          </nxl:layoutRowWidget>
        </tr>
      </nxl:layoutRow>

    </tbody>
  </table>

</c:if>

</f:subview>